<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
           <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
           <LINK href="style.css" rel="stylesheet" type="text/css">
           <title>Mariachi Casa</title>
           <style>
              body {
                 background-image:url('chips-and-salsa.jpg');
                 background-repeat:no-repeat;
              }
           </style>
	</head>
<body>
<?php

	//constraints:
	require_once 'defs.h'; //info to connect to mysql
	require_once 'start.obj'; //contains customer class
	session_start(); //begin session to access global data

/*******************************Second Perspective******************************/
	if($_POST) {

		//terminate session
		if($_POST['logout']) unset($_SESSION['customer']);

		//check the session for the object
		if($_SESSION['customer']) {
			$customer = $_SESSION['customer']; //set the object
			foreach($_POST as $item) //check for added items
				$customer->meal($item); //make part of the customer

			echo 'You\'re drinking: ';
			foreach($customer as $action => $value)
				if($action == 'drink') 
					foreach($value as $bev) 
						echo $bev. ' ,';
			echo "\n";
		} //end check

	} //conclude second perspective

/*******************************First Perspective********************************/
	//store global object
	if(!$_SESSION['customer']) {
		$customer = new CUSTOMER(1.1); //create customer at table number
		$_SESSION['customer'] = $customer; //store in session
	} // end global storage

	//commence table
	//echo '<table border="1">';
	//echo "<tr>\n";

       echo "<div id=\"topButtons\">\n";
       echo "<div id=\"translateButton\" style=\"width:45%; float:left\"><button class=\"backButton\" onclick=\"\">Espanol</button></div>";
       echo "<button class=\"backButton\" onclick=\"\">Admin</button>";
       echo "</div><br/>";

       echo "<img src=\"MariachiCasaLogo.png\" alt=\"Mariachi Casa\">";

	//process Drinks menu
	echo "<form method=\"post\" action=\"drinks.cgi\">\n";
	echo "<div id=\"drinkButton\" style=\"float:left; width:45%\"><button class=\"menuButton\" onclick=\"\">Drinks</button></div>";
	echo "</form>\n";

	//process Food menu
	echo "<form method=\"post\" action=\"menu.php\">\n";
	echo "<div id=\"foodButton\"><button class=\"menuButton\" onclick=\"\">Menu</button></div><br/>";
	echo "</form>\n";

	//echo "</tr>\n<tr>\n"; //break table column

	//process Ticket screen
	echo "<form method=\"post\" action=\"ticket.php\">\n";
	echo "<div id=\"ticketButton\" style=\"float:left; width:45%\"><button class=\"menuButton\" onclick=\"\">Ticket</button></div>";
	echo "</form>\n";

	//process Feedback screen
	echo "<form method=\"post\" action=\"feedback.php\">\n";
	echo "<div id=\"commentButton\"><button class=\"menuButton\" onclick=\"\">Feedback</button></div><br/>";
	echo "</form>\n";

       //process Game screen
	echo "<form method=\"post\" action=\"gameScreen.html\">\n";
	echo "<div id=\"gameButton\"><button class=\"menuButton\" onclick=\"\">Games</button></div>";
	echo "</form>\n";

	//echo "</tr>\n"; //conclude rows
	//echo "</table>\n"; //conclude table

	echo "<form method=\"post\">\n";
	echo "<input type=\"submit\" name=\"logout\" value=\"LogOut\" />\n"; //end the session
	echo "</form>\n";

       echo "<div id=\"pageBottom\">";
       echo "<button class=\"footerButton\" onclick\"\">Help</button>";
       echo "<button class=\"footerButton\" onclick=\"\">Refill</button>";
       echo "</div>"

?>
</body>

</html>

